var initialState={
    newList:{},
    products:{},
    carts:[]
}

export const reducer=(state=initialState,action)=>{
    const {type,payload}={action}
    switch (type) {       
        case "GETNEWS":
            return Object.assign({}, state , {newsList:payload} );
            break;    
        case "GETPRODUCTS":
             return Object.assign({}, state , {products:payload} );
        break;    
        case "ADDCARTS":
                return Object.assign({}, state , {carts:[...state.carts,payload]} );
        break;   
        default:return state
            break;
    }
}

